import { request } from "@utils/http"

// 引入类型
import {
    hospitalListsearchParamsType,
    hospitalListReqReturnType,
    getProvinceReturnRequestType,
    hosListDetailType,
    DepartmentListReturnType,
    HoslistScheduleType,
    scheduleRuleReturnType,
    findeScheduleType,
    findeScheduleReturnType
} from '@api/hospital/model/hospitalListType'


// 获取医院列表请求
export const gethospitalListRequest = (page: number, limit: number, searchParams: hospitalListsearchParamsType) => {
    return request.get<any,hospitalListReqReturnType>(`/admin/hosp/hospital/${page}/${limit}`, {
        params: searchParams
    })
}

// 获取省份请求
export const getProvinceRequest = ()=>{
    return request.get<any,getProvinceReturnRequestType>(`/admin/cmn/dict/findByDictCode/province`)
}

// 获取市和区的请求
export const getCityOrAreaRequest = (value:string)=>{
    return request.get<any,getProvinceReturnRequestType>(`/admin/cmn/dict/findByParentId/${value}`)
}


// 获取医院详情的请求
export const hosListDetailRequest = (id:string)=>{
    return request.get<any,hosListDetailType>(`/admin/hosp/hospital/show/${id}`)
}


// 获取上下线状态的请求
export const changeStatusRequest = (id:string,status:0 | 1)=>{
    return request.get<any,null>(`/admin/hosp/hospital/updateStatus/${id}/${status}`)
}



// 请求医院科室
export const getHosDepartmentListRequest = (hoscode:string)=>{
    return request.get<any,DepartmentListReturnType>(`/admin/hosp/department/${hoscode}`)
}

// 请求排班规则安排
export const getScheduleRuleRequest = ({page,limit,hoscode,depcode}:HoslistScheduleType)=>{
    return request.get<any,scheduleRuleReturnType>(`/admin/hosp/schedule/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`)
}


// 请求医师排班安排
export const getFindScheduleRequest = ({hoscode,depcode,workDate}:findeScheduleType)=>{
    return request.get<any,findeScheduleReturnType>(`/admin/hosp/schedule/findScheduleList/${hoscode}/${depcode}/${workDate}`)
}